Skip to content

feat: Allow displaying group-by columns on LHS of table - #2149

Merged
kodiakhq[bot] merged 2 commits into
mainfrom
drew/display-group-columns-lhs
Apr 23, 2026
Merged

kodiakhq[bot] merged 2 commits into
mainfrom
drew/display-group-columns-lhs

Conversation

@pulpdrew

@pulpdrew pulpdrew commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds a new display setting for table charts, allowing the user to show Group-By columns on the left side of the table, before the series columns. The default remains the same (show group by columns on the RHS).

The existing group-by column detection code in DBTableChart has been improved to handle a few more cases than it was before, resulting in fewer numeric group-by columns being affected by the NumberFormat.

Screenshots or video

Screenshot 2026-04-22 at 2 24 43 PM Screenshot 2026-04-22 at 2 24 58 PM

How to test locally or on Vercel

This can be tested in the preview environment, in a dashboard or chart explorer table.

References

  • Linear Issue: Closes HDX-4080
  • Related PRs:

@vercel

vercel Bot commented Apr 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview, Comment Apr 23, 2026 3:38pm

Request Review

@changeset-bot

changeset-bot Bot commented Apr 22, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d01d8a2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@hyperdx/common-utils Patch
@hyperdx/api Patch
@hyperdx/app Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 150 passed • 3 skipped • 1151s

Status Count
✅ Passed 150
❌ Failed 0
⚠️ Flaky 4
⏭️ Skipped 3

Tests ran across 4 shards in parallel.

View full report →

@pulpdrew
pulpdrew force-pushed the drew/display-group-columns-lhs branch from 88be6c3 to 38ae330 Compare April 22, 2026 19:03
@pulpdrew
pulpdrew marked this pull request as ready for review April 22, 2026 19:03
@github-actions github-actions Bot added the review/tier-4 Critical — deep review + domain expert sign-off label Apr 22, 2026
@github-actions

github-actions Bot commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

🔴 Tier 4 — Critical

Touches auth, data models, config, tasks, OTel pipeline, ClickHouse, or CI/CD.

Why this tier:

  • Critical-path files (2):
    • packages/api/src/routers/external-api/v2/dashboards.ts
    • packages/api/src/routers/external-api/v2/utils/dashboards.ts
  • Cross-layer change: touches frontend (packages/app) + backend (packages/api) + shared utils (packages/common-utils)

Review process: Deep review from a domain expert. Synchronous walkthrough may be required.
SLA: Schedule synchronous review within 2 business days.

Stats
  • Production files changed: 9
  • Production lines changed: 102 (+ 437 in test files, excluded from tier calculation)
  • Branch: drew/display-group-columns-lhs
  • Author: pulpdrew

To override this classification, remove the review/tier-4 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions

github-actions Bot commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

PR Review

feat: Allow displaying group-by columns on LHS of table — well-structured feature with solid test coverage (unit + E2E). No critical bugs or security issues.

  • ⚠️ Implicit column-order contract — DBTableChart.tsx:303 infers group-by keys by counting from the end of allKeys, relying on ClickHouse always returning series columns before group-by columns. If that query contract ever changes, column detection silently breaks. Consider at minimum a code comment (or assertion in dev) documenting this invariant.

  • ⚠️ configType defaults to undefined, not 'sql' — ChartDisplaySettingsDrawer.tsx:166: showGroupByColumnsOnLeft = displayType === DisplayType.Table && configType !== 'sql'. Any caller that omits configType will show the checkbox for SQL table configs too. The actual reordering is correctly guarded by isBuilderChartConfig() so there's no data bug, but the checkbox would appear and do nothing. Verify all ChartDisplaySettingsDrawer callsites pass configType, or flip the default to require an explicit 'builder' opt-in.

  • ℹ️ groupByColumnsOnLeft is added to _ChartConfigSchema (the base schema shared by all chart types), not just the table-specific schema. Low risk, but it leaks the field into non-table configs where it has no meaning.

✅ Logic for ratio configs (seriesCount = 1), empty result sets, and raw SQL pass-through are all handled correctly and covered by tests.

@@ -109,10 +121,11 @@ export default function ChartDisplaySettingsDrawer({
<Stack>
{isTimeChart && (
<>
<Checkbox
<CheckBoxControlled

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix - these checkboxes were not being reset when the reset to defaults button is clicked, since they accept a checked prop instead of the value prop provided by {...register(...)}

) {
groupByKeys = queriedConfig.groupBy.split(',').map(v => v.trim());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This old logic failed when the groupBy contained an alias

@pulpdrew
pulpdrew force-pushed the drew/display-group-columns-lhs branch from 38ae330 to 1eb9585 Compare April 22, 2026 19:11
@pulpdrew
pulpdrew requested review from a team and karl-power and removed request for a team April 22, 2026 19:25
@kodiakhq
kodiakhq Bot merged commit 4c23e10 into main Apr 23, 2026
18 checks passed
@kodiakhq
kodiakhq Bot deleted the drew/display-group-columns-lhs branch April 23, 2026 15:44
kodiakhq Bot pushed a commit that referenced this pull request May 6, 2026
)

## Summary

Follow-up to #2149. Drew added `groupByColumnsOnLeft` to the
external-API table chart config and to the conversion path in #2149,
but the MCP `hyperdx_save_dashboard` tool did not advertise the field
on its table-tile schema. As a result, MCP clients had no way to
discover or set the option, even though the underlying save / fetch
plumbing already supports it.

This change adds the field to `mcpTableTileSchema.config` and extends
the existing multi-tile MCP test to assert a table tile with
`groupByColumnsOnLeft: true` round-trips through `hyperdx_save_dashboard`.

## Test plan

- [x] `yarn tsc --noEmit` clean in `packages/api`
- [x] `yarn lint` clean in `packages/api`
- [x] Existing MCP dashboard suite passes; the `should create a dashboard with multiple tile types` row now also asserts `groupByColumnsOnLeft` on the table tile round-trips
- [x] External API tests covering `groupByColumnsOnLeft` round-trip still pass (no change to that surface; verified locally)

This branch was successfully deployed

1 active deployment
Preview — d01d8a23 Deployed Apr 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge review/tier-4 Critical — deep review + domain expert sign-off

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants